<template>
  <Modal v-model="modal" :width="800" title="所有评论">
    <div class="content">
      <List  item-layout="vertical" v-if="list.length">
          <ListItem v-for="item in list" :key="item.title">
              <ListItemMeta :avatar="item.avatar" :title="item.user_name" :description="item.content" />
              <template slot="extra">
                  {{ item.create_time }}
              </template>
          </ListItem>
      </List>
      <div v-else>
        暂无评论
      </div>
    </div>
    <div slot="footer">
      <Button class="mr" size="large" type="text" @click="closeModal">关闭</Button>
    </div>
  </Modal>
</template>
<script>
import PictureEditItem from "@/components/PictureEditItem"
export default {
  components: {
    PictureEditItem
  },
  data() {
    return {
      modal: false,
      disabled: false,
      storeContractId: null,
      form: {
         content: []
      },
      order_id: '',
      uploadList: [],
      list: []
    }
  },
  methods: {
    getData() {
      this.$ajaxGet(`/order/discussList`, {order_id: this.order_id}).then(data => {
         this.list = data
      })
    },
    openModal(item) {
      this.modal = true;
      this.order_id = item.order_id
      this.getData(item)
    },
    uploadPic(value) {
      this.form.imgPath = value.length > 0 ? value.map(item => item.url) : value[0].url;
    },
    closeModal() {
      this.modal = false
    },
    onSave() {
        let param = {
          order_id: this.order_id,
          content: this.form.content
        }
        this.$jsonPost(`/order/addDiscuss`, param).then(data => {
          this.closeModal()
          this.$Notice.success({
            title: '操作成功'
          })
          this.this.form.content = ''
          this.$emit("complete")
        }).catch(() => {
          this.closeModal()
        })
    }
  }
}
</script>
